<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<link href="/resources/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<script src="/resources/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="/resources/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
<script src="/resources/lib/jquery-validation/jquery.validate.min.js" type="text/javascript"></script> 
<script src="/resources/lib/jquery-validation/jquery.metadata.js" type="text/javascript"></script>
<script src="/resources/lib/jquery-validation/messages_cn.js" type="text/javascript"></script>
<script src="/resources/lib/json2.js" type="text/javascript"></script>
<script type="text/javascript">
var form = null;
$(function (){
    form = $("form").ligerForm({
        inputWidth: 170, labelWidth: 90, space: 40,
        validate: true,
        fields:[
        { name: "uuid", type: "hidden" },
        { display: "常量编码", name: "code", newline: true, type: "text",validate:{ required: true,minlength:3,maxlength:10} }, 
        { display: "常量名称", name: "name", newline: true, type: "text",validate:{ required: true,minlength:3,maxlength:10} }, 
        { display: "备注", name: "name", newline: true, type: "text",validate:{ required: true,minlength:3,maxlength:10} } 
        ],
        buttons :[
					{ text: '提交',click:submitForm}
        ]
     });
    });
function submitForm(){
	 var data = form.getData(); 
	if (form.valid())
    {
		console.log(data);
		$.ajax({
           loading: '正在保存数据中...',
           url: "/system/saveSysConstants",
           data: data,
           success: function (json) {
           	console.log(json);
                alert(JSON2.stringify(json));
           },
           error: function (message) {
               //LG.tip(message);
               alert(message);
           }
       });
    }
    else
    {
        form.showInvalid();
    } 
}
</script>
<style type="text/css">
    .l-table-edit {}
    .l-table-edit-td{ padding:4px;}
    .l-button-submit,.l-button-reset{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
</style>
</head>
<body style="padding:10px">
	<form id="form2"></form> 
</body>
</html>